<template>
	<view class="indexs">
		<view class="header header_wi" :style="'padding-top: ' + navH + 'px;'">
			<view class="header_height" :style="
          'height:' +
          gaodu +
          'px;line-height:' +
          gaodu +
          'px;top:' +
          gaodutops +
          'px;'
        ">
				<view class="index_h_cont3">
					<view class="index_wenben_img" @tap="jumpzuo">
						<image :src="imgUrl + '/dzx_img33.png'" mode="widthFix"></image>
					</view>
					<view class="index_wenben">{{
            $t("page_cangkudizhi.warehouse_address")
          }}</view>
				</view>
			</view>
			<view class="coloe_title">s</view>
		</view>
		<view class="index_center" :style="'padding-top:' + (navH + 50) + 'px;'">
			<view class="cangkudizhi_center">
				<view class="cangkudizhi_item1">
					<view class="cangkudizhi_item1_list">
						<view class="cangkudizhi_item1_cont">
							<view class="cangkudizhi_item1_t1">{{
                $t("page_cangkudizhi.recipient")
              }}</view>
							<view class="cangkudizhi_item1_t2">{{
                cangkudetails.linkman
              }}</view>
							<view class="cangkudizhi_item1_t3" @tap="fuzhi" :data-name="cangkudetails.linkman">
								{{ $t("page_cangkudizhi.copy") }}
							</view>
						</view>
						<view class="cangkudizhi_item1_cont">
							<view class="cangkudizhi_item1_t1">{{
                $t("page_cangkudizhi.phone_number")
              }}</view>
							<view class="cangkudizhi_item1_t2">{{
                cangkudetails.phone
              }}</view>
							<view class="cangkudizhi_item1_t3" @tap="fuzhi" :data-name="cangkudetails.phone">
								{{ $t("page_cangkudizhi.copy") }}
							</view>
						</view>
						<view class="cangkudizhi_item1_cont">
							<view class="cangkudizhi_item1_t1">{{
                $t("page_cangkudizhi.pecipient_address")
              }}</view>
							<view class="cangkudizhi_item1_t2">
								{{ cangkudetails.region.province }}{{ cangkudetails.region.city
                }}{{ cangkudetails.region.region }}{{ cangkudetails.address }}
							</view>
							<view class="cangkudizhi_item1_t3" @tap="fuzhi" :data-name="
                  cangkudetails.region.province +
                  cangkudetails.region.city +
                  cangkudetails.region.region +
                  cangkudetails.address
                ">
								{{ $t("page_cangkudizhi.copy") }}
							</view>
						</view>
						<view class="cangkudizhi_item1_cont">
							<view class="cangkudizhi_item1_t1">{{
                $t("page_cangkudizhi.post_code")
              }}</view>
							<view class="cangkudizhi_item1_t2">{{ cangkudetails.post }}</view>
							<view class="cangkudizhi_item1_t3" @tap="fuzhi" :data-name="cangkudetails.post">
								{{ $t("page_cangkudizhi.copy") }}
							</view>
						</view>
					</view>
					<view class="cangkudizhi_item1_btn" @tap="fuzhi" :data-name="wenben">
						{{ $t("page_cangkudizhi.one_click_copy") }}
					</view>
				</view>
				<view class="cangkudizhi_item2">
					<view class="cangkudizhi_item2_title">
						<image :src="imgUrl + '/dzx_img30.png'"></image>
						<text>{{ $t("page_cangkudizhi.operation_guide") }}</text>
					</view>
					<view class="cangkudizhi_item2_list">
						<view class="cangkudizhi_item2_cont">
							<view class="cangkudizhi_item2_t1">{{ newuserprocess.first_title }}</view>
							<view class="cangkudizhi_item2_t2">{{ newuserprocess.first_remark }}</view>
						</view>
						<view class="cangkudizhi_item2_cont">
							<view class="cangkudizhi_item2_t1">{{ newuserprocess.second_title }}</view>
							<view class="cangkudizhi_item2_t2">{{ newuserprocess.second_remark }}</view>
						</view>
						<view class="cangkudizhi_item2_cont">
							<view class="cangkudizhi_item2_t1">{{ newuserprocess.third_title }}</view>
							<view class="cangkudizhi_item2_t2">{{ newuserprocess.third_remark }}</view>
						</view>
						<view class="cangkudizhi_item2_cont">
							<view class="cangkudizhi_item2_t1">{{ newuserprocess.fourth_title }}</view>
							<view class="cangkudizhi_item2_t2">{{ newuserprocess.fourth_remark }}</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	// pages/shouye/shouye_zkc/shouye_zkc.js
	const app = getApp();

	let request = require("../../../utils/require");

	export default {
		data() {
			return {
				navH: app.globalData.navHeight,
				gaodu: app.globalData.height,
				gaodutops: app.globalData.top,
				imgUrl: app.globalData.imgUrl,

				cangkudetails: {
					shop_name: "",
					phone: "",
					linkman: "",
					region: {
						province: "",
						city: "",
						region: "",
					},

					address: "",
					post: "",
				},

				wenben: "",
				optionsid: "",
				newuserprocess:''
			};
		},
		/**
		 * 生命周期函数--监听页面加载
		 */
		onLoad(options) {
			var that = this;
			that.optionsid = options.id
			that.cangkuxq();
		},
		onShow() {
			var that = this;
			that.settingFun();
		},
		/**
		 * 生命周期函数--监听页面初次渲染完成
		 */
		onReady: function() {},
		/**
		 * 生命周期函数--监听页面隐藏
		 */
		onHide: function() {},
		/**
		 * 生命周期函数--监听页面卸载
		 */
		onUnload: function() {},
		/**
		 * 页面相关事件处理函数--监听用户下拉动作
		 */
		onPullDownRefresh: function() {},
		/**
		 * 页面上拉触底事件的处理函数
		 */
		onReachBottom: function() {},
		/**
		 * 用户点击右上角分享
		 */
		onShareAppMessage: function() {},
		methods: {
			//设置
			settingFun() {
				var that = this;
				var data = {
					token: uni.getStorageSync('token')
				};
				request.post(`index.php?s=/api/page/service&wxapp_id=` + uni.getStorageSync('web_id'), data).then(res => {
					if (res.data.code == 1) {
						that.newuserprocess= res.data.data.userclient.newuserprocess
						uni.setStorageSync('setting', res.data.data.values);
						uni.setStorageSync('paytype', res.data.data.paytype);
						uni.setStorageSync('copyright', res.data.data.copyright);
						uni.setStorageSync('userclient', res.data.data.userclient);
						uni.setStorageSync('weight_mode', res.data.data.values.weight_mode);
						uni.setStorageSync('price_mode', res.data.data.values.price_mode);
						uni.setStorageSync('appname', res.data.data.values.name);
						uni.setStorageSync('is_packagestation', res.data.data.values.is_packagestation);
						uni.setStorageSync('is_categorysearch', res.data.data.values.is_categorysearch);
						uni.setStorageSync('address_setting', res.data.data.values.address_setting);
						uni.setStorageSync('menu_type', res.data.data.values.menu_type);
					} else {
						uni.showToast({
							title: res.data.msg,
							icon: 'none'
						});
					}
				});
			},
			//复制
			fuzhi: function(e) {
				var that = this;
				uni.setClipboardData({
					data: e.currentTarget.dataset.name,
					success: function(res) {
						uni.getClipboardData({
							success: function(res) {
								uni.showToast({
									title:that.$t('page_other.复制成功'),
								});
							},
						});
					},
				});
			},

			cangkuxq() {
				var that = this;
				var data = {
					id: that.optionsid,
					token: uni.getStorageSync("token"),
				};
				if(uni.getStorageSync("usermark")){
					data['usermark'] = uni.getStorageSync("usermark").mark;
				}
				request
					.get(
						`index.php?s=/api/page/storageDetails&wxapp_id=` +
						uni.getStorageSync("web_id"),
						data
					)
					.then((res) => {
						if (res.data.code == 1) {
							var items =
								res.data.data.linkman +
								"," +
								res.data.data.phone +
								"," +
								res.data.data.region.province +
								res.data.data.region.city +
								res.data.data.region.region +
								res.data.data.address +
								"," +
								res.data.data.post;
								that.cangkudetails = res.data.data
								that.wenben = items
							console.log(res.data, "re?????");
						}
					});
			},

			jumpzuo() {
				uni.navigateBack();
			},
		},
	};
</script>
<style>
	@import "./cangkudizhi.css";
</style>